import request from '@/utils/axios';
import { attendance } from '@/config/env'

export const page = query => {
  return request({
    url: attendance + '/arrange/group/page',
    method: 'post',
    data: query,
  });
};

export const find = query => {
  return request({
    url: attendance + '/arrange/group/find',
    method: 'post',
    data: query,
  });
};

export const findById = id => {
  return request({
    url: attendance + '/arrange/group/' + id,
    method: 'get',
  });
};

export const save = model => {
  return request({
    url: attendance + '/arrange/group',
    method: 'post',
    data: model,
  });
};

export const edit = model => {
  return request({
    url: attendance + '/arrange/group/' + model.id,
    method: 'put',
    data: model,
  });
};

export const del = id => {
  return request({
    url: attendance + '/arrange/group/' + id,
    method: 'delete',
  });
};

export const batDel = ids => {
  return request({
    url: attendance + '/arrange/group',
    method: 'delete',
    data: ids,
  });
};

export const findShiftByGroupId = id => {
  return request({
    url: attendance + '/group/' + id + '/shift',
    method: 'get',
  });
};

export const insertGroupShift = model => {
  return request({
    url: attendance + '/group/shift',
    method: 'post',
    data: model,
  });
}

export const delGroupShift = query => {
  return request({
    url: attendance + '/group/' + query.id + '/shift',
    method: 'delete',
    data: query.data,
  });
}

export const findStaffByGroupId = query => {
  return request({
    url: attendance + '/group/' + query.id + '/staff/page',
    method: 'post',
    data: query.data,
  });
};

export const insertGroupStaff = model => {
  return request({
    url: attendance + '/group/staff',
    method: 'post',
    data: model,
  });
};

export const delStaffByGroupId = query => {
  return request({
    url: attendance + '/group/' + query.id + '/staff',
    method: 'delete',
    data: query.data,
  });
};

export const findCalendarByGroupId = id => {
  return request({
    url: attendance + '/group/' + id + '/calendar',
    method: 'get',
  });
};

export const findSystemByGroupId = id => {
  return request({
    url: attendance + '/group/' + id + '/system',
    method: 'get',
  });
};